package com.onlineMIS.ORM.DAO.headQ.user;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import com.onlineMIS.ORM.DAO.BaseDAO;
import com.onlineMIS.ORM.entity.headQ.user.HeadQRegionMgUserChain;

@Repository
public class HeadQRegionMgUserChainDAOImpl extends BaseDAO<HeadQRegionMgUserChain>{

    public List<Integer> getChainIdsByUser(int userId){
		DetachedCriteria criteria = DetachedCriteria.forClass(HeadQRegionMgUserChain.class);	
		criteria.add(Restrictions.eq("userId", userId));

		List<HeadQRegionMgUserChain> chainList = this.getByCritera(criteria, true);
		
		List<Integer> chainIdSet = new ArrayList<Integer>();
		for (HeadQRegionMgUserChain c: chainList) {
			chainIdSet.add(c.getChainId());
		}
		
		return chainIdSet;
    }




}
